import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    access_token: "",
    Role: "",
    id:"",
    userName: "",
    bookName:"",
    bookType:""
  },
  mutations: {
    changeLogin: function (state, user) {
       CryptoJS.enc.Base64.stringify(obj) //加密
       CryptoJS.enc.Base64.parse(base64).toString(CryptoJS.enc.Utf8) //解密
      state.access_token = user.access_token;
      state.refresh_token = user.refresh_token;
      localStorage.setItem("access_token", state.access_token);
      sessionStorage.setItem("user_message", state.user_message);//
      localStorage.setItem("refresh_token", state.refresh_token);
    }
  },
  actions: {},
  modules: {}
});
